package io.bluefw.blueui.dsl;

import java.util.List;

import org.eclipse.jetty.util.StringUtil;

import io.bluefw.blueui.dsl.render.layout.BlankLayout;
import io.bluefw.blueui.dsl.render.layout.Column2Layout;
import io.bluefw.blueui.dsl.render.layout.Column3Layout;
import io.bluefw.blueui.dsl.render.layout.LayoutRender;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
public class Layout {
	private String layout;
	
	public StringBuffer render(List<Widget> widgets) {
		LayoutRender render = null;
		if ("column3".equals(layout)) {
			render = new Column3Layout(widgets);
		} else if ("column2".equals(layout)) {
			render = new Column2Layout(widgets);
		} else if (StringUtil.isBlank(layout)) {
			render = new BlankLayout(widgets);
		}
		return render.render();
	}
}
